﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// ItemList 的摘要描述
/// </summary>
public class ItemList
{
	public ItemList()
	{
		//
		// TODO: 在此加入建構函式的程式碼
		//
	}
    private string _itemType;
    public string itemType
    {
        get
        {
            return _itemType;
        }
        set
        {
            _itemType = value;
        }
    }
    private string _itemCode;
    public string itemCode
    {
        get
        {
            return _itemCode;
        }
        set
        {
            _itemCode = value;
        }
    }
    private string _itemName;
    public string itemName
    {
        get
        {
            return _itemName;
        }
        set
        {
            _itemName = value;
        }
    }
    private string _itemMemo;
    public string itemMemo
    {
        get
        {
            return _itemMemo;
        }
        set
        {
            _itemMemo = value;
        }
    }
    public void getItemFromItemList()
    {
        using (TR_DBDataContext db = new TR_DBDataContext())
        {
            var itemList = from P in db.TR_ItemList where P.ItemCode.Trim().Equals(_itemCode) && P.ItemType.Trim().Equals(_itemType) select P;
            if (itemList.Count() > 0)
            {
                TR_ItemList item = (from P in db.TR_ItemList where P.ItemCode.Trim().Equals(_itemCode) && P.ItemType.Trim().Equals(_itemType) select P).First();
                _itemType = item.ItemType.TrimEnd();
                _itemName = item.ItemName.TrimEnd();
                _itemMemo = item.ItemMemo.TrimEnd();
            }
        }
    }
}
